package com.captainbank.tcl.tclapplication.ui.activity.basic;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.captainbank.tcl.tclapplication.R;
import com.captainbank.tcl.tclapplication.ui.activity.function.AgentwebActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.AnimationsViewActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.AutoEmailActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.CalendarActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.DialogFragmentActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.GravActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.GreendaoActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.HTextActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.JGAuthActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.JGMagicWindowActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.JGShareActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.JsWebviewActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.LeakcanaryActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.LiveActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.LoopBannerActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.LottieActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.LunarActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.MarqueeActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.MotionLayoutActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.MultiStatusActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.MultiWaveHeaderActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.RSATestActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.Retrofit2Activity;
import com.captainbank.tcl.tclapplication.ui.activity.function.RxJava2Activity;
import com.captainbank.tcl.tclapplication.ui.activity.function.RxPermissionsActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.SMSActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.SVGAActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.ShadowActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.SmartRefreshLayoutActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.SphereViewActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.SuperTextActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.ToolsAttrActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.UploadFileActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.VideoActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.ViewAnimatorActivity;
import com.captainbank.tcl.tclapplication.ui.activity.function.X5WebviewActivity;
import com.captainbank.tcl.tclapplication.ui.activity.test.TempTest2Activity;
import com.captainbank.tcl.tclapplication.ui.activity.test.TempTestActivity;
import com.captainbank.tcl.tclapplication.utils.MyToast;
import com.gyf.barlibrary.ImmersionBar;

import butterknife.BindView;
import butterknife.OnClick;
import cn.magicwindow.MLinkAPIFactory;
import cn.magicwindow.mlink.annotation.MLinkDefaultRouter;

/**
 * Created by TCL on 2019/4/3.
 * Describe:
 */
@MLinkDefaultRouter
public class MainActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;

    private Intent intent;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //场景还原（APP未安装下，首次下载打开app实现场景还原）
        MLinkAPIFactory.createAPI(this).deferredRouter();
    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this)
                .fitsSystemWindows(true)
                .statusBarColor(R.color.colorPrimary)
                .statusBarDarkFont(true, 0.2f)
                .init();
    }

    @Override
    protected boolean isMultiStatusEnabled() {
        return true;
    }

    @Override
    protected void initView() {
        toolbar.setTitle(getString(R.string.app_name));
    }

    @OnClick({R.id.btn_temp_test, R.id.btn_temp_test2, R.id.btn_dialogfragment, R.id.btn_smartrefreshlayout, R.id.btn_auto_email, R.id.btn_calendar, R.id.btn_retrofit2, R.id.btn_rxjava2,
            R.id.btn_lunar, R.id.btn_mw, R.id.btn_multi_status, R.id.btn_jg_share, R.id.btn_jg_auth, R.id.btn_grav, R.id.btn_wave_head
            , R.id.btn_upload_file, R.id.btn_marquee, R.id.btn_live, R.id.btn_video, R.id.btn_svga, R.id.btn_shadow, R.id.btn_lottie
            , R.id.btn_agentweb, R.id.btn_animations, R.id.btn_leakcanary, R.id.btn_permission, R.id.btn_htext, R.id.btn_supertext
            , R.id.btn_banner, R.id.btn_jswebview, R.id.btn_x5view, R.id.btn_rsa, R.id.btn_viewanimator, R.id.btn_sms, R.id.btn_motionlayout
            , R.id.btn_greendao, R.id.btn_tool_attr, R.id.btn_sphere_view})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_temp_test:
                intent = new Intent(this, TempTestActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_temp_test2:
                intent = new Intent(this, TempTest2Activity.class);
                startActivity(intent);
                break;
            case R.id.btn_dialogfragment:
                intent = new Intent(this, DialogFragmentActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_smartrefreshlayout:
                intent = new Intent(this, SmartRefreshLayoutActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_auto_email:
                intent = new Intent(this, AutoEmailActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_calendar:
                intent = new Intent(this, CalendarActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_retrofit2:
                intent = new Intent(this, Retrofit2Activity.class);
                startActivity(intent);
                break;

            case R.id.btn_rxjava2:
                intent = new Intent(this, RxJava2Activity.class);
                startActivity(intent);
                break;

            case R.id.btn_lunar:
                intent = new Intent(this, LunarActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_mw:
                intent = new Intent(this, JGMagicWindowActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_multi_status:
                intent = new Intent(this, MultiStatusActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_jg_share:
                intent = new Intent(this, JGShareActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_jg_auth:
                intent = new Intent(this, JGAuthActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_grav:
                intent = new Intent(this, GravActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_wave_head:
                intent = new Intent(this, MultiWaveHeaderActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_upload_file:
                intent = new Intent(this, UploadFileActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_marquee:
                intent = new Intent(this, MarqueeActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_live:
                requestPermission(1, new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, new Runnable() {
                    @Override
                    public void run() {
                        intent = new Intent(MainActivity.this, LiveActivity.class);
                        startActivity(intent);
                    }
                }, new Runnable() {
                    @Override
                    public void run() {
                        MyToast.toastError(MainActivity.this, "亲， 没有权限", false);
                    }
                });
                break;

            case R.id.btn_video:
                intent = new Intent(this, VideoActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_svga:
                intent = new Intent(this, SVGAActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_shadow:
                intent = new Intent(this, ShadowActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_lottie:
                intent = new Intent(this, LottieActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_agentweb:
                intent = new Intent(this, AgentwebActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_animations:
                intent = new Intent(this, AnimationsViewActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_leakcanary:
                intent = new Intent(this, LeakcanaryActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_permission:
                intent = new Intent(this, RxPermissionsActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_htext:
                intent = new Intent(this, HTextActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_supertext:
                intent = new Intent(this, SuperTextActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_banner:
                intent = new Intent(this, LoopBannerActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_jswebview:
                intent = new Intent(this, JsWebviewActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_x5view:
                intent = new Intent(this, X5WebviewActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_rsa:
                intent = new Intent(this, RSATestActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_viewanimator:
                intent = new Intent(this, ViewAnimatorActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_sms:
                intent = new Intent(this, SMSActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_motionlayout:
                intent = new Intent(this, MotionLayoutActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_greendao:
                intent = new Intent(this, GreendaoActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_tool_attr:
                intent = new Intent(this, ToolsAttrActivity.class);
                startActivity(intent);
                break;

            case R.id.btn_sphere_view:
                intent = new Intent(this, SphereViewActivity.class);
                startActivity(intent);
                break;

        }
    }

}
